package com.own.business.pay.common.em;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;

/**
 * PayEnum
 *
 * @author chenxueli
 * @date 2023-08-17 15:39:00
 */
public class PayEnum {

    private static final Map<String, Method> PAY_METHOD_MAP = Map.of(
            Method.ALIPAY.getType(), Method.ALIPAY,
            Method.WECHAT.getType(), Method.WECHAT,
            Method.BALANCE.getType(), Method.BALANCE
    );

    public static Method getPayMethod(String method) {
        if (PAY_METHOD_MAP.containsKey(method)) {
            return PAY_METHOD_MAP.get(method);
        }
        throw new RuntimeException("支付方式[{}]不存在");
    }

    @Getter
    @AllArgsConstructor
    public enum Method {

        /**
         * 支付宝
         */
        ALIPAY("alipay"),
        /**
         * 微信
         */
        WECHAT("wechat"),
        /**
         * 余额钱包
         */
        BALANCE("balance"),
        ;

        private final String type;

    }

    public enum Type {

        /**
         * 手机移动支付
         */
        MOBILE,
        /**
         * 二维码
         */
        QR_CODE,

    }

}
